from pymilvus import connections, Collection, FieldSchema, DataType, CollectionSchema
import random
from pprint import pprint

connections.connect(
    "default", host="192.168.1.62", port="19530", db_name="zhangrenyang"
)

fields = [
    FieldSchema(name="id", dtype=DataType.INT64, is_primary=True, auto_id=True),
    FieldSchema(name="embedding", dtype=DataType.FLOAT_VECTOR, dim=128),
    FieldSchema(name="category", dtype=DataType.INT64),
]

schema = CollectionSchema(fields)
collection = Collection("mixed_collection", schema)
embeddings = [[random.random() for _ in range(128)] for _ in range(100)]
categories = [random.randint(1, 5) for _ in range(100)]
data = [embeddings, categories]
collection.insert(data)
